/*
 * Accelerometer.h
 *
 *  Created on: Jan 16, 2014
 *      Author: ppks
 */

#ifndef ACCELEROMETER_H_
#define ACCELEROMETER_H_

/******************************************************************************/
/* Accelerometer Configuration                                                */
/******************************************************************************/
#if (ACCELEROMETER_TYPE == MPU6050)
/* Define the I2C address if not defined yet in global config.h */
#ifndef ACCL_ADDRESS
    #define ACCL_ADDRESS            0x68   /* address pin AD0 low (GND), default for FreeIMU v0.4 and InvenSense evaluation board */
    //#define MPU6050_ADDRESS       0x69   /* address pin AD0 high (VCC) */
#endif /* #ifndef ACCL_ADDRESS */

/* Define the data register */
#define ACCL_DATA_REGISTER          0x3B

#endif /* (ACCELEROMETER_TYPE == MPU6050) */

#define ACC_1G_VALUE                512

#define ACCZ_25DEG                  (int16_t)(ACC_1G_VALUE * 0.90631)       /* 0.90631 = cos(25deg) (cos(theta) of accZ comparison) */
#define ACC_VEL_SCALE               (9.80665f / 10000.0f / ACC_1G_VALUE)

#define ACC_Z_DEADBAND              (ACC_1G_VALUE >> 5)  /* was 40 instead of 32 now */

/********************************************************************************/
/* Exported Variables Declaration                                               */
/********************************************************************************/

/********************************************************************************/
/* Exported Functions Prototypes                                                */
/********************************************************************************/
extern void Accelerometer_Init(void);
extern void Accelerometer_ReadRawADC(void);

#endif /* ACCELEROMETER_H_ */
